﻿using IListNode;
using System;
using System.Collections.Generic;

namespace JZ_06_cong_wei_dao_tou_da_yin_lian_biao_lcof
{
    class Program
    {
        static void Main (string[] args)
        {
            ListNode head = new ListNode (1);
            head.next = new ListNode (3);
            head.next.next = new ListNode (2);

            int[] res = new Solution ().ReversePrint (head);

            Console.WriteLine ();
        }
    }

    public class Solution
    {
        List<int> nums = new List<int> ();
        public int[] ReversePrint (ListNode head)
        {
            if (head == null) return nums.ToArray ();
            ReversePrint (head.next);
            nums.Add (head.val);

            return nums.ToArray ();
        }
    }
}
